package com.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.mapper.ItemsParamMapper;
import com.shop.pojo.ItemsParam;
import com.shop.service.ItemsParamService;
import com.shop.vo.ItemsParamQueryRequest;
import com.shop.vo.ItemsParamSaveRequest;
import com.shop.vo.ItemsParamUpdateRequest;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;



@Service("itemsParamService")
public class ItemsParamServiceImpl extends ServiceImpl<ItemsParamMapper, ItemsParam> implements ItemsParamService {

    @Override
    public IPage<ItemsParam> page(Page page, ItemsParamQueryRequest request){
        QueryWrapper<ItemsParam> wrapper = ItemsParam.queryWrapper(request);
        return this.page(page,wrapper);
    }

    @Transactional
    @Override
    public void save(ItemsParamSaveRequest request){
        ItemsParam itemsParam = new ItemsParam();
        BeanUtils.copyProperties(request,itemsParam);
        this.save(itemsParam);
    }

    @Transactional
    @Override
    public void update(ItemsParamUpdateRequest request){
        ItemsParam itemsParam = new ItemsParam();
        BeanUtils.copyProperties(request,itemsParam);
        this.updateById(itemsParam);
    }

    @Transactional
    @Override
    public void delete(String id){
        UpdateWrapper<ItemsParam> updateWrapper = new UpdateWrapper();
        this.update(updateWrapper);
    }

}